package com.example.service.impl;

import com.example.mapper.LogMapper;
import com.example.model.Log;
import com.example.model.PageBean;
import com.example.service.LogService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import jakarta.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LogServiceImpl implements LogService {
    @Resource
    private LogMapper logMapper;

    @Override
    public PageBean getLogs(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Log> logList=logMapper.getLogs();
        System.out.println(logList.toString());
        Page<Log> p= (Page<Log>) logList;
        return new PageBean(p.getTotal(),p.getResult());
    }
}
